package com.xmjs.baselibrary.network;

/**
 * 表示请求错误时，返回的数据模型
 * （具体还得根据实际项目接口来重构下面的数据模型）
 */
public class ResponseError extends RuntimeException {

    public ResponseError() {

    }

    public ResponseError(ResponseBean bean) {
        ok = bean.isOk();
        code = bean.getCode();
        message = bean.getMessage();
        data = bean.getData();
    }

    public ResponseError(int code, String message) {
        this.code = code;
        this.message = message;
    }

    //状态
    private boolean ok;

    //返回码
    private int code;

    //返回信息
    private String message;

    //返回的数据集
    private String data;

    public int getCode() {
        return code;
    }

    public void setCode(int code) {
        this.code = code;
    }

    public boolean isOk() {
        return ok;
    }

    public void setOk(boolean ok) {
        this.ok = ok;
    }

    @Override
    public String getMessage() {
        return message;
    }

    public void setMessage(String message) {
        this.message = message;
    }

    public String getData() {
        return data;
    }

    public void setData(String datas) {
        this.data = datas;
    }

    @Override
    public String toString() {
        return "RequestError{" +
                "ok='" + ok + '\'' +
                "message='" + message + '\'' +
                ",code=" + code +
                ",data='" + data + '\'' +
                '}';
    }

}